//
//  MyGroupHeaderView.m
//  TableViewOpenDemo
//
//  Created by offcn_zcz32036 on 2017/4/11.
//  Copyright © 2017年 offcn. All rights reserved.
//

#import "MyGroupHeaderView.h"

@implementation MyGroupHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor=[UIColor lightGrayColor];
        self.stateImageView=[[UIImageView alloc]initWithFrame:CGRectMake(15, 14, 16, 16)];
        self.stateImageView.image=[UIImage imageNamed:@"close"];
        [self addSubview:self.stateImageView];
        self.groupNameLabel=[[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.stateImageView.frame)+5, self.frame.size.height/2-8, [UIScreen mainScreen].bounds.size.width-20-CGRectGetWidth(self.stateImageView.frame), 16)];
        self.groupNameLabel.font=[UIFont systemFontOfSize:16];
        self.groupNameLabel.backgroundColor=[UIColor clearColor];
        [self addSubview:self.groupNameLabel];
    }
    return self;
}
-(void)setGroupName:(NSString *)groupName
{
    _groupName=groupName;
    _groupNameLabel.text=groupName;
}
-(void)setOpen:(BOOL)open
{
    _open=open;
    if (_open) {
        self.stateImageView.image=[UIImage imageNamed:@"open"];
    }
    else
    {
        self.stateImageView.image=[UIImage imageNamed:@"close"];
    }
}
@end
